home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / xdme_1.84_src.lha / XDME / Src / Var / ComTree.tplt < prev    next >
Encoding:
Text File  |  1994-11-06  |  1.4 KB  |  78 lines

  1.  
  2.  
  3. int do_command (char * str)
  4. {
  5.     char     * arg;
  6.     char     * aux1,
  7.          * aux2,
  8.          * repstr[MAXIA];
  9.     char       quoted;
  10.     WORD       repi = 0;
  11.     long       j;
  12.     WORD       low;
  13.     WORD       high;
  14.     WORD       diff;
  15.     static int level = 0;
  16.     COMM     * comm;
  17. #ifdef DEBUG_FILE
  18.     static FILE * debug_file = NULL;
  19.  
  20.     if (!debug_file && GETF_DEBUG(Ep))
  21.     debug_file = fopen ("t:XDME.debug", "w");
  22. #endif
  23.  
  24.     if (!str || !*str)
  25.     return (1);
  26.  
  27. #ifdef DEBUG_FILE
  28.     if (debug_file && GETF_DEBUG(Ep))
  29.     fprintf (debug_file, "%s\n", str);
  30. #endif
  31.  
  32.     if (MacroRecord != 0 && level == 0) {       /* PATCH_NULL [14 Feb 1993] : added */
  33.     add_record (str);                       /* PATCH_NULL [14 Feb 1993] : added */
  34.     } /* if */                    /* PATCH_NULL [14 Feb 1993] : added */
  35.  
  36.     if (++level > 20)
  37.     {
  38. DEFMESSAGE( _COM_recursion_too_deep, "command:\nRecursion too deep" )
  39.     error ("command:\nRecursion too deep");
  40.     --level;
  41.  
  42.     foundcmd = 1;    /* to prevent us from trying an ARexx macro */
  43.  
  44.     return (0);
  45.     }
  46.  
  47.     while ((arg = breakout (&str, "ed, &aux1)) &&
  48.         !(GETF_LOOPBREAK(Ep) || GETF_LOOPCONT(Ep)) )
  49.     {
  50.  
  51. $(@FOREACH@comtree@
  52. $(value)
  53. )
  54.  
  55. fail:
  56.     --level;
  57.  
  58.     while (--repi >= 0)
  59.         free (repstr[repi]);
  60.  
  61.     if (aux1) free (aux1);
  62.  
  63.     return 0;
  64.  
  65. loop:
  66.     if (aux1) free (aux1);
  67.     } /* while (arg) */
  68.  
  69.     --level;
  70.  
  71.     while (--repi >= 0)
  72.     free (repstr[repi]);
  73.  
  74.     return 1;
  75. } /* do_command */
  76.  
  77.  
  78.